package cn.cumt.lkk.webapp.controller;

import cn.cumt.lkk.service.PersonManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by lkk on 2015/4/17.
 */
@Controller
@RequestMapping("/persons*")
public class PersonController {

    private PersonManager personManager;

    @Autowired
    public void setPersonManager(@Qualifier("personManager") PersonManager personManager) {
        this.personManager = personManager;
    }

    @RequestMapping(method = RequestMethod.GET)
    public ModelAndView handleRequest() throws Exception {
        return new ModelAndView().addObject(personManager.getAll());
    }
}
